#include <stdlib.h>

#include "../Utils/Utils.h"
#include "../Utils/BasicTypes.h"
#include "../LocalStack/LocalStack.h"

#include "../SparceMatrix/sparse_matrix.h"

#include "NumList.h"
#include "ListOfNumList.h"

void DeleteNumList(void* inp)
{
	NumList *temp, *list;
	
	list = (NumList*)inp;
	
	if (list == NULL)
		return;
	
	while(list->next != NULL)
	{
		temp = list;
		list = list->next;
		free(temp);
	}
	free(list);
}

NumList* NewNumList()
{
	START();
	
	NumList* ret = (NumList*)NEW(sizeof(NumList));
	ret->next = NULL;
	
	RETURN(ret);
}

void SetNumListSizes(NumList* numList)
{
	int counter = 0;
	NumList* iter = NULL;

	if (numList == NULL)
		return;
	
	for (iter = numList; iter->next != NULL; iter = iter->next)
		counter++;
	
	for (iter = numList; iter->next != NULL; iter++)
		iter->size = counter--;
}
